home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2005 October
/
PCWOCT05.iso
/
Software
/
FromTheMag
/
Syn Text Editor 2.1.0.46
/
synsetup-2.1.0.46.exe
/
{app}
/
scripts
/
mac_cs-rcs.vbs
< prev
next >
Wrap
Text File
|
2003-08-13
|
6KB
|
211 lines
' Caption: CS-RCS|
' Hint: Component Software RCS|
' Icon: |
'
' syn
' Copyright (C) 2000-2003, Ascher Stefan. All rights reserved.
' stievie@utanet.at, http://web.utanet.at/ascherst/
'
' The contents of this file are subject to the Mozilla Public License
' Version 1.1 (the "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
' http://www.mozilla.org/MPL/
'
' Software distributed under the License is distributed on an "AS IS" basis,
' WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
' the specific language governing rights and limitations under the License.
'
' The Original Code is mac_cs-rcs.vbs, released Sun, 26 May 2002 10:55:39 UTC.
'
' The Initial Developer of the Original Code is Ascher Stefan.
' Portions created by Ascher Stefan are Copyright (C) 2000-2003 Ascher Stefan.
' All Rights Reserved.
'
' Contributor(s): .
'
' Alternatively, the contents of this file may be used under the terms of the
' GNU General Public License Version 2 or later (the "GPL"), in which case
' the provisions of the GPL are applicable instead of those above.
' If you wish to allow use of your version of this file only under the terms
' of the GPL and not to allow others to use your version of this file
' under the MPL, indicate your decision by deleting the provisions above and
' replace them with the notice and other provisions required by the GPL.
' If you do not delete the provisions above, a recipient may use your version
' of this file under either the MPL or the GPL.
'
' You may retrieve the latest version of this file at the syn home page,
' located at http://syn.sourceforge.net/
'
' $Id: mac_cs-rcs.vbs,v 1.3.2.5 2003/08/13 00:38:45 neum Exp $
' Version 2.2 Macro
' Script to call ComponentSoftware's RCS, if you're not using this implementation
' from RCS, you may want to access it via the commandline.
dim Form
sub Main(dummy)
dim btnStatus, btnHistory, btnCheckout, btnCheckin, btnExplorer, btnCompare, btnClose
Form = Create("TForm", null, "FindForm")
with Form
.Caption = "RCS"
.Position = "poScreenCenter"
.BorderStyle = "bsDialog"
.Width = 100
.Height = 260
' .FormStyle = "fsStayOnTop"
end with
btnStatus = Create("TButton", Form)
With btnStatus
.Parent = Form
.Caption = "&Status"
.Default = true
.Left = 10
.Top = 10
.Width = 75
.Enabled = not IsEmpty(ActiveDocument)
.Hint = "Show Status for active Document"
.OnClick = "RcsStatus"
End With
btnHistory = Create("TButton", Form)
With btnHistory
.Parent = Form
.Caption = "&History"
.Left = 10
.Top = 40
.Width = 75
.Enabled = not IsEmpty(ActiveDocument)
.Hint = "Show History for active Document"
.OnClick = "RcsHistory"
End With
btnCheckout = Create("TButton", Form)
With btnCheckout
.Parent = Form
.Caption = "Check-&out"
.Left = 10
.Top = 70
.Width = 75
.Enabled = not IsEmpty(ActiveDocument)
.Hint = "Check out active Document"
.OnClick = "RcsCheckOut"
End With
btnCheckin = Create("TButton", Form)
With btnCheckin
.Parent = Form
.Caption = "Check-&in"
.Left = 10
.Top = 100
.Width = 75
.Enabled = not IsEmpty(ActiveDocument)
.Hint = "Check in active Document"
.OnClick = "RcsCheckIn"
End With
btnExplorer = Create("TButton", Form)
With btnExplorer
.Parent = Form
.Caption = "&Explorer"
.Left = 10
.Top = 130
.Width = 75
.Hint = "Show Document Explorer"
.OnClick = "RcsExplorer"
End With
btnCompare = Create("TButton", Form)
With btnCompare
.Parent = Form
.Caption = "&Compare"
.Left = 10
.Top = 160
.Width = 75
.Enabled = not IsEmpty(ActiveDocument)
.Hint = "Compare active Document with the last revision"
.OnClick = "RcsCompare"
End With
btnClose = Create("TButton", Form)
With btnClose
.Parent = Form
.Caption = "C&lose"
.Cancel = true
.Left = 10
.Top = 200
.Width = 75
.ModalResult = 1
.Hint = "Close this Dialog"
End With
Form.ShowModal
Form.Free
end sub
sub RcsStatus(Sender)
dim rcsapp
set rcsapp = CreateObject("Csrcssrv.Application")
if not IsEmpty(ActiveDocument) then
rcsapp.StatusEx ActiveDocument.FileName, false
end if
end sub
sub RcsHistory(Sender)
dim rcsapp
set rcsapp = CreateObject("Csrcssrv.Application")
if not IsEmpty(ActiveDocument) then
rcsapp.History ActiveDocument.FileName
end if
end sub
sub RcsCheckOut(Sender)
dim rcsapp
Set rcsapp = CreateObject("Csrcssrv.Application")
if not IsEmpty(ActiveDocument) then
rcsapp.CheckOut ActiveDocument.FileName
end if
end sub
sub RcsCheckIn(Sender)
dim rcsapp
dim fname
if not IsEmpty(ActiveDocument) then
fname = ActiveDocument.FileName
set rcsapp = CreateObject("Csrcssrv.Application")
if rcsapp.GetRCSState(fname) = 0 then
rcsapp.AddToRcs fname
else
rcsapp.CheckIn fname
end if
end if
end sub
sub RcsExplorer(Sender)
dim rcsapp
set rcsapp = CreateObject("Csrcssrv.Application")
rcsapp.PrjExplorer ""
end sub
sub RcsCompare(Sender)
dim fName
dim rcsapp
dim objShell
if not IsEmpty(ActiveDocument) then
set rcsapp = CreateObject("Csrcssrv.Application")
fName = rcsapp.GetHeadRevision(ActiveDocument.FileName)
set rcsapp = nothing
' The Diff Tool to compare the two files, you may also use the Tool shipped with CS-RCS (CSDiff.exe)
const DiffExe = "D:\Eigene Dateien\Delphi Projekte\TextDiff\TextDiff.exe"
if fName <> "" and ActiveDocument.FileName <> "" then
' Now run a Diff Tool like WinDiff, I use TextDiff (http://rpi.net.au/~ajohnson/delphi/)
set objShell = CreateObject("WScript.Shell")
if objShell.Run(IntAddQuotes(DiffExe) & " " & IntAddQuotes(fName) & " " & IntAddQuotes(ActiveDocument.FileName), 1, false) <> 0 then
MsgBox "Can not start " & DiffExe, 16, "RCS"
end if
end if
end if
end sub
private function IntAddQuotes(s)
IntAddQuotes = Chr(34) & s & Chr(34)
end function